#!/bin/sh
# PCP QA Test No. 1703
# Exercise the bpftrace PMDA - run unittests
#

seq=`basename $0`
echo "QA output created by $seq"

. ./common.bpftrace

case `admin/whatami`
in
    *openSUSE\ Leap\ 15.*)
	_notrun "this test does not work on openSUSE 15.x"
	;;
esac

_pmdabpftrace_check

case `hostname -s`
in
    bozo-vm)
	    _notrun "cannot set bpftrace hz=999 on this VM"
	    ;;
esac

status=1       # failure is the default!

_filter_test_duration()
{
    sed -E -e "s/test(s?) in .+/test\1/g"
}

$sudo PYTHONPATH="$PCP_PMDAS_DIR/bpftrace" $python -Wi::DeprecationWarning -m unittest discover $here/bpftrace "*_tests.py" 2>&1 > $seq_full | \
_filter_test_duration


status=0
exit
